#define _CRT_SECURE_NO_WARNINGS 1
#include <iostream> // 
#include <algorithm> // std::sort 
#include <vector> // std::vector
using namespace std;

class Solution {
public:
    int MoreThanHalfNum_Solution(vector<int>& numbers) {
        if (numbers.size() == 1)
            return numbers[0];
        std::sort(numbers.begin(), numbers.end());
        int count = 1;
        for (int i = 1; i < numbers.size(); i++)
        {
            if (numbers[i - 1] == numbers[i])
            {
                count++;
            }
            else {
                count = 1;
            }

            if (count > numbers.size() / 2)
            {
                return numbers[i];
            }
        }
        return -1;

    }
};

int main()
{

    return 0;
}